﻿using Dropit.Extension.Core;
using SocialPack.Composer.Extensions;

namespace SocialPack.Composer.modules.SocialPack.Composer.Functions.Facebook
{
    public partial class LoginButton : BaseContentFunction
    {
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (ContentFunctionData.IsValue("CountryCode"))
            {
                this.LoginButtonControl.CountryCode = ContentFunctionData.Property["CountryCode"].ToString();
            }

            if (ContentFunctionData.IsValue("ShowFaces"))
            {
                this.LoginButtonControl.ShowFaces = (bool)ContentFunctionData.Property["ShowFaces"].Value;
            }

            if (ContentFunctionData.IsValue("Width"))
            {
                this.LoginButtonControl.Width = (int)ContentFunctionData.Property["Width"].Value;
            }

            if (ContentFunctionData.IsValue("MaxRows"))
            {
                this.LoginButtonControl.MaxRows = (int)ContentFunctionData.Property["MaxRows"].Value;
            }

            if (ContentFunctionData.IsValue("Permissions"))
            {
                this.LoginButtonControl.Permissions = ContentFunctionData.Property["Permissions"].ToString();
            }
        }
    }
}